using GalaSoft.MvvmLight;
using System.Collections.Generic;
using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.Messaging;
using System;
using System.Collections.ObjectModel;
using PocketBook.UI.ViewModel.Workspaces;
using PocketBook.Domain.Abstract;
using PocketBook.UI.Infrastructure;
using Ninject;

namespace PocketBook.UI.ViewModel
{
    /// <summary>
    /// This class contains properties that the main View can data bind to.
    /// <para>
    /// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
    /// </para>
    /// <para>
    /// You can also use Blend to data bind with the tool's support.
    /// </para>
    /// <para>
    /// See http://www.galasoft.ch/mvvm
    /// </para>
    /// </summary>
    public class MainWindowViewModel : WorkspaceViewModel
    {
        public ObservableCollection<WorkspaceViewModel> Workspaces { get; set; }

        private const string ExpensesWorkspacePropertyName = "ExpensesWorkspace";
        private ExpensesWorkspaceViewModel _expensesWorkspace;
        public ExpensesWorkspaceViewModel ExpensesWorkspace
        {
            get
            {
                return _expensesWorkspace;
            }
            set 
            {
                if (_expensesWorkspace == value)
                {
                    return;
                }
                _expensesWorkspace = value;
                RaisePropertyChanged(ExpensesWorkspacePropertyName);
            }
        }
        public IncomesWorkspaceViewModel IncomesWorkspace { get; set; }

        public MainWindowViewModel()
        {
            ExpensesWorkspace = new ExpensesWorkspaceViewModel(this);
            IncomesWorkspace = new IncomesWorkspaceViewModel(this);

            Workspaces = new ObservableCollection<WorkspaceViewModel> 
            {
                new FileWorkspaceViewModel(this),
                IncomesWorkspace,
                ExpensesWorkspace,
                new StatusWorkspaceViewModel(this)
            };
        }
    }
}